//number[]:
// 代表当前的类型是数组,并且数组中的值的类型是number
const arr1: number[] = [1, 2, 3, 4]
arr1.push(2)

//(number | string)[]:
// 当前是一个数组,数组的类型可能是number也可能是string
const arr2: (number | string)[] = [1, '3', 5, '7']
arr2.push(2)
arr2.push('4')

//使用泛型定义数组类型
const arr4: Array<number> = [1, 2, 3, 4]